﻿using System;
using Brouteforce.utilities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Brouteforce.OldStuff.oldGameObjs {

    public class Sprite{
        public Location Location;
        public Texture2D Texture;
        public Color TintColor;
        public Color? BorderColor = null;

        public Sprite(Texture2D texture, Rectangle location){
            if (texture == null) throw new Exception("texture cannot be null");
            Location = new Location(location);
            Texture = texture;
            TintColor = Color.White;
        }

        public Sprite(Texture2D texture, Location location) {
            if (texture == null) throw new Exception("texture cannot be null");
            Location = location;
            Texture = texture;
            TintColor = Color.White;
        }

        public void Update(){
            //nothing currently
        }

        public void Draw(int cameraX, int cameraY){
            var positionRelativeToCamera = Location.GetPositionRelativeToCamera(cameraX, cameraY);
            BFGame.SpriteBatch.Draw(Texture, positionRelativeToCamera, TintColor);
            if (BorderColor.HasValue) Draws.DrawBorder(positionRelativeToCamera, BorderColor.Value, 1);
        }

    }
}
